<% if current_user && @node.tags.size == 0 %>
  <div class="alert alert-warning"><%= raw translation('wiki.show.page_has_no_tags', url: 'javascript: document.getElementById("tags-open").click();') %></div>
<% end %>

<% if @node.main_image && !@presentation %>
  <% img_path = @node.main_image.path(@node.main_image.photo_file_name == "blob" ? :original : :large) # special case for "blob" images, see https://github.com/publiclab/plots2/issues/10210 %>
  <a style="margin-bottom:10px;" href="<%= @node.main_image.path(:original) %>">
  <%= image_tag(img_path, class:"rounded", style:'max-width:100%;max-height:600px;display:block;margin:0 auto 10px;', lazy: @node.main_image.photo_file_name == "blob") %>
  </a>
<% end %>

<br class="d-lg-none" style="clear:both;" />

<h1 style="font-size:3em;margin-top:20px;text-align:center;font-family:'Junction Light';">
  <%= @revision.title %>
  <% if @presentation || @node.has_tag('style:minimal') %>
  <a rel="tooltip" title="Show or Hide the toolbar." data-placement="right" onClick="$('#wiki-toolbar').toggle()" class="btn btn-link"><b class="fa fa-caret-down"></b></a>
  <% end %>
</h1>

<% if @is_revision %>
  <div class="alert alert-warning">
    <%= raw translation('wiki.show.revision_from', :time => @revision.created_at.to_s(:long)) %>
    <a href="/wiki/revisions/<%= @node.slug_from_path %>">
      <%= translation('wiki.show.view_all_revisions') %>
    </a>
  </div>
<% end %>

<div <% if @presentation || @node.has_tag('style:minimal') %>style="display:none" <% end %>id="wiki-toolbar">
  <div class="d-print-none">

    <div style="padding-top:8px;text-align:center">
      <span class="d-none d-lg-inline">
        <span rel="popover" style='cursor: pointer;' title="Authors" data-html="true" data-placement="top" data-content= "
        <ul class='p-0'>
        <% @node.authors.each do |author| %>
          <li style='list-style: none;'><a href='/profile/<%= author&.username %>' style='color: #009bff;'>@<%= author&.username %></a></li>
        <% end %>
      </ul>
      "> <i style="color:#888;" class="fa fa-user"></i> <%= number_with_delimiter(@node.authors.size) %></span>  | 
        <a rel="tooltip" title="View all revisions for this page." data-placement="top" href="/wiki/revisions/<%= @node.slug_from_path %>"><i style="color:#888;" class="fa fa-history"></i> <%= @node.revisions.size %></a> |
        <a aria-label="Practice in a realtime doc" href="/talk/<%= @node.slug_from_path %>" rel="tooltip" title="Practice in a realtime doc." data-placement="top"><i style="color:#888;" class="fa fa-comment"></i></a> |
        <a rel="tooltip" title="Link to wiki" aria-label="Link to wiki" href="/n/<%= @node.id %> data-placement="top"><i style="color:#888;" class="fa fa-link"></i></a> <span class="d-none d-xl-inline"><a href="/n/<%= @node.id %>">#<%= @node.id %></a></span>
      </span>
      <details class="d-inline-flex flex-column position-relative">
        <summary id="toc-menu" class="btn btn-light" role="button" aria-label="Table of Contents" aria-haspopup="menu"><i class="fa fa-list-ul" aria-hidden="true"></i></summary>
        <span class="js-toc position-absolute shadow p-0 rounded" role="menu"></span>
      </details>
    </div>
  </div>
</div>

<br />

<% if params[:raw] == 'true' %>
  <div class="alert alert-warning" style="">This is the new (beta) Inline Rich Wikis system. Use the "pencil" buttons after different paragraphs to edit inline, and <a href="/wiki/issues">report problems here</a></div>
<% end %>

<% if @node.has_power_tag('parent') %>
  <% parent = Node.find_by(slug: @node.power_tag('parent')) %>
  <% if parent %>
  <div class="alert alert-success" style="border-color:#eee;background:#f8f8f8;color:#aaa;">&laquo; <%= raw translation('wiki.show.back_to_wiki', :url1 => parent.path, :title => parent.latest.title) %></a></div>
  <% end %>
<% end %>

<% if @node.has_power_tag('tabbed') %>
<nav class="navbar navbar-light bg-light navbar-expand">
  <ul class="navbar-nav">
    <li class="nav-item"><a class="nav-link" data-toggle="tab" href="#legacy-editor-container"><%= translation('wiki.show.overview') %></a></li>
    <% if @node.power_tags('tabbed').include?("notes") %><li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#tab-notes"><%= translation('wiki.show.research') %></a></li><% end %>
    <% if @node.power_tags('tabbed').include?("wikis") %><li class="nav-item"><a class="nav-link active" data-toggle="tab" href="#tab-wikis"><%= raw translation('wiki.show.wiki_pages') %></a></li><% end %>
  </ul>
</nav>
<% end %>

